doctype html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
html(xmlns="http://www.w3.org/1999/xhtml")
  head
    meta(http-equiv="Content-Type" content="text/html; charset=utf-8")
    title 找茬赢肾七
    meta(name="viewport" content="width=device-width,initial-scale=1")
    link(rel='stylesheet' href='/stylesheets/nitpick/reset.css' type='text/css')
    link(rel='stylesheet' href='/stylesheets/nitpick/style.css' type='text/css')
    script(src='http://7xogoq.com1.z0.glb.clouddn.com/itbserver/api/js/jquery-1.11.0.min.js')
    script.
      function getUploadServer(){return '!{locals.global.upload_sever_url}';};
      function getAPIServer(){return '!{locals.global.api_sever_url}'};
      var gUrl='#{imgUrl}';

  body
    block content

      //div.top_black
      //  img.loading(src="../images/flag/loading.gif")

      div.wrapper
        div.container
          // 标题
          div.title
            img.title_img(src="../images/nitpick/pic_01.png" alt)
            p.date 2016.10.22 - 2016.11.11
            div.title_message
              span 一键生成有哪些您觉得应该有的功能?
              span 我们邀请您分享自己的看法，如果您的建议被采纳
              span 就有机会把iPhone7带回家！

          // 建议
          div.advice
            img.advice_title(src="../images/nitpick/pic_02.png" alt="")
            div.advice_content
              textarea.advice_message(wrap="physical" name="comment" required rows="5" placeholder="")

          // 手机
          div.tel
            img.tel_title(src="../images/nitpick/pic_03.png" alt="")
            div.tel_content
              input.telphone(type="text" maxlength="11" style="ime-mode:Disabled" onkeypress="numOnly(event)")

          // 提交与分享
          input.submit(style="font-family:微软雅黑; letter-spacing:0.1em; -webkit-appearance:none;" type="button" name="submit" value="提交意见" onClick="doSubmit()")
          //a.share(href="#" target="") 分享活动
          input.share(style="font-family:微软雅黑; letter-spacing:0.1em; -webkit-appearance:none;" type="button" name="share" value="分享活动" onClick="doShare()")

          // 奖品
          div.prize
            img.prize_pic01(src="../images/nitpick/pic_04.png" alt='')
            p.prize_01 一等奖iPhone7 1台
            img.prize_pic02(src="../images/nitpick/pic_05.png" alt='')
            p.prize_02 二等奖
              br
              拍立得3台
            img.prize_pic03(src="../images/nitpick/pic_06.png" alt='')
            p.prize_03 三等奖
              br
              小米充电宝5台

          div.footer 最终解释权归示界港科技所有

      //div.share(style='bottom:100px')
      //  div.jiathis_style_24x24
      //    a.jiathis_button_weixin
      //    a.jiathis_button_qzone
      //    a.jiathis_button_tqq
      //    a.jiathis_button_tsina


      script(src="../javascripts/com/common.js")
      script.
        $(function(){
          //var url = getUploadServer() +"/upload/user?user_id="+#{uId};
          //$(".top_black").hide();
        })

        if(typeof window.JSCallMobile == "undefined"){
          if(typeof JSCallMobile == "undefined"){
            JSCallMobile = {};
            JSCallMobile.jsPopWeixin = function(title,content, imageUrl, url){
              setTimeout(function(){
                //alert("没有找到接口:JSCallMobile.jsPopWeixin, 参数: "+title+','+content +','+ imageUrl+','+ url);
                alert("请下载一键生成App分享活动 ");
              },100);
            }
            window.JSCallMobile = JSCallMobile;
          }else{
            window.JSCallMobile = JSCallMobile;
          }
        }

        //var jiathis_config = {
        //  siteNum: 4,
        //  sm: "weixin,cqq,tqq,tsina",
        //  summary: "",
        //  boldNum: 4,
        //  shortUrl: false,
        //  hideMore: false
        //}

        function myAlert(msg) {
          setTimeout(function(){
            alert(msg);
          },1);
        }

        function numOnly(e) {
          var codeNum=e.keyCode||e.which;

          if(codeNum==8||codeNum==37||codeNum==39||(codeNum>=48&&codeNum<=57)){
            e.returnValue=codeNum;
          }else{
            e.returnValue=false;
          }
        }

        function chkTel(num) {
          if (!(/^1[34578]\d{9}$/.test(num))) {
            return false;
          }
          return true;
        }

        function doSubmit() {
          var tel = $('.telphone').val();
          var advice = $('.advice_message').val();

          if (advice && advice.length>0) {
            if(chkTel(tel)){
              //
              $.ajax({
                type: "POST",
                url: getAPIServer() + "/preview/nitpickProc",
                dataType: 'json',
                data:{
                  tel: tel,
                  advice: advice
                },
                error: function (err) {
                  myAlert(err.msg||'网络错误 请重新尝试');
                },
                success: function (ret) {
                  if (ret && ret.success == 1) {
                    window.location.href= getAPIServer()+'/preview/nitpickOK';

                  } else if (!ret || ret.success == 0) {
                    myAlert('请重新尝试');
                  }
                }
              });

            } else {
              myAlert("请输入正确手机号");
            }

          } else {
            myAlert("请输入您的建议");
          }
        }

        function doShare(){
          window.JSCallMobile.jsPopWeixin(
                  '找茬赢肾七',
                  '一键生成邀你来找茬! 肾七,拍立得,小米充电宝等你来抢!',
                  'http://itbour-image.oss-cn-hangzhou.aliyuncs.com/test/cha.jpg',
                  'http://www.itbour.com/min/download/download.html'
          );
        }
      //script(type="text/javascript" src="http://v3.jiathis.com/code_mini/jia.js" charset="utf-8")
